home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / monitor / mcall.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  914 b   |  62 lines

  1. # include    <ingres.h>
  2. # include    <sccs.h>
  3.  
  4. SCCSID(@(#)mcall.c    8.1    12/31/84)
  5.  
  6.  
  7.  
  8. /*
  9. **  MCALL -- call a macro
  10. **
  11. **    This takes care of springing a macro and processing it for
  12. **    any side effects.  Replacement text is saved away in a static
  13. **    buffer and returned.
  14. **
  15. **    Parameters:
  16. **        mac -- the macro to spring.
  17. **
  18. **    Returns:
  19. **        replacement text.
  20. **
  21. **    Side Effects:
  22. **        Any side effects of the macro.
  23. **
  24. **    Trace Flags:
  25. **        51
  26. */
  27.  
  28. char *
  29. mcall(mac)
  30. char    *mac;
  31. {
  32.     register char    c;
  33.     register char    *m;
  34.     register char    *p;
  35.     static char    buf[100];
  36.     extern char    macsget();
  37.  
  38.     m = mac;
  39.  
  40. #    ifdef xMTR2
  41.     tTfp(51, -1, "mcall('%s')\n", m);
  42. #    endif
  43.  
  44.     /* set up to process the macro */
  45.     macinit(macsget, &mac, FALSE);
  46.  
  47.     /* process it -- throw away result */
  48.     for (p = buf; (c = macgetch()) > 0; )
  49.     {
  50. #        ifdef xMTR2
  51.         if (tTf(51, 1))
  52.             putchar(c);
  53. #        endif
  54.         if (p < &buf[sizeof buf])
  55.             *p++ = c;
  56.     }
  57.  
  58.     *p = 0;
  59.  
  60.     return (buf);
  61. }
  62.